package com.atguigu.chaptar3

object $10_TraitDefined {
    def main(args: Array[String]): Unit = {
      val b = new B with Log {
        override val age: Int = 18

        override def printHello(): Unit = "hallowzx"
      }
      println(b.age)
      println(b.name)
      println(b.add(3, 5))
  }

}
trait Log{
  //具体属性
  val name ="lisi"
  //具体方法
  def add(x:Int,y:Int)=x+y
  //抽象属性
  val age:Int
  //抽象方法
  def printHello():Unit
}
class B
class A extends B with Log {
  override val age: Int = 18

  override def printHello(): Unit = print("haha")
}
